<%@ page import="java.util.List" %>
<%@ page import="top.wuyang.study.javaexam.TbGoods" %>
<%@ page import="top.wuyang.study.javaexam.TbGoodsDAO" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2024/6/23
  Time: 18:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>主列表</title>
    <link href="../lib/bootstarp.min.css" rel="stylesheet">
</head>
<body>

<h2>
    <a href="../index.jsp">返回目录</a>
</h2>

<%
    List<TbGoods> list = TbGoodsDAO.query();
%>


<div>
    <div>
        <div><h2 style="text-align: center">商品信息表</h2></div>
        <div style="text-align:right;padding-bottom: 0.8rem">
            <a href="insert.jsp" class="btn btn-success" >添加商品信息</a>
        </div>
    </div>

    <table class="table table-hover table-striped table-bordered">
        <thead>
        <tr class="text-bg-success">
            <th>编号</th>
            <th>类型</th>
            <th>商品名称</th>
            <th>售价</th>
            <th>数量</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <%
            for (TbGoods tbGoods : list){
        %>
        <tr>
            <td><%=tbGoods.getId()%></td>
            <td><%=tbGoods.getTypeinfo()%></td>
            <td><%=tbGoods.getGname()%></td>
            <td><%=tbGoods.getPrice()%></td>
            <td><%=tbGoods.getAmount()%></td>
            <td>
                <a href="delete.jsp?id=<%=tbGoods.getId()%>" class="btn btn-sm btn-danger">删除</a>
            </td>
        </tr>
        <% } %>
        </tbody>
    </table>
</div>



</body>
</html>
